<?php
// +----------------------------------------------------------------------
// | Tplay [ WE ONLY DO WHAT IS NECESSARY ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017 http://tplay.pengyichen.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 听雨 < 389625819@qq.com >
// +----------------------------------------------------------------------


namespace app\admin\controller;


use \think\Db;
use app\admin\model\IncomeRecord as IncomeRecordModel;

class IncomeRecord extends Permissions
{
    /**
     * 轮播图列表
     * @return [type] [description]
     */
    public function index()
    {
        //实例化轮播图模型
        $model = new IncomeRecordModel();

        $admin = empty($where) ? $model->join('user', 'user.id=income_record.user_id')
            ->join('goods', 'goods.id=income_record.goods_id')
            ->field('income_record.*,user.username,goods.goods_name')
            ->order('create_time sort')->paginate(20) : $model->where($where)->order('create_time desc')->paginate(20, false, ['query' => $this->request->param()]);

        $this->assign('admin', $admin);
        return $this->fetch();
    }


}
